<%@page import="java.util.Enumeration"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/taglib.jsp" %>

<div class="hs-layout-pager">
	<script type="text/javascript">
	$(function() {
		//日期范围
		$( "#from" ).datepicker({
				onClose: function( selectedDate ) {
				$( "#to" ).datepicker( "option", "minDate", selectedDate );
			}
	  	});
		$( "#to" ).datepicker({
			onClose: function( selectedDate ) {
				$( "#from" ).datepicker( "option", "maxDate", selectedDate );
			}
		});
	});
	</script>
	<form action="${admin}/book/book" class="hs-search">
		<label>书名</label><input type="text" name="bookname" value="${param.bookname}" />
		<label>出版日期</label><input type="text" name="from" id="from" value="${param.from}" /><label>--</label>
		<input type="text" name="to" id="to" value="${param.to}" />
		<input type="submit" value="查询" />
	</form>
	<table class="hs-table">
		<tbody>
			<tr>
				<th>序号</th>
				<th>书名</th>
				<th>简介</th>
				<th>出版日期</th>
				<th>单价</th>
				<th>库存</th>
				<th>分类</th>
				<th>操作</th>
			</tr>
			<c:forEach var="book" items="${dataPaging.result}">
				<tr>
					<td><c:out value="${book.id}" /></td>
					<td><c:out value="${book.bookName}" /></td>
					<td><c:out value="${book.intro}" /></td2>
					<td><fmt:formatDate value="${book.publicationDate}" pattern="yyyy-MM-dd"/></td>
					<td><c:out value="${book.price}" /></td>
					<td><c:out value="${book.stores}" /></td>
					<c:forEach var="bookPart" items="${bookParts}">
						<c:if test="${bookPart.id eq book.bookPartId}">
							<td><c:out value="${bookPart.partName}" /></td>
						</c:if>
					</c:forEach>
					<td>
						<a href="${admin}/book/book/edit/${book.id}">修改</a>
						<a href="${admin}/book/book/delete/${book.id}" class="delete">删除</a>
					</td>
				</tr>	
			</c:forEach>
		</tbody>
	</table>
</div>
<div class="hs-toolbar-buttons">
	<a href="${admin}/book/book/create" class="hs-toolbar-button hs-icon-create">添加</a>
</div>
<div id="hs-pager">
	<hs:pager />
<%-- 	<hs:pager dataPaging="${dataPaging}" action="${admin}/book/book" showPageNumber="10" /> --%>
</div>
<hs:message />
